list comprehension hackerrank solution in python